<template>

  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

          <!--<a-col :xl="6" :lg="7" :md="8" :sm="24">-->
            <!--<a-form-item-->
              <!--label="更新年月">-->
              <!--<a-month-picker style="width:100%" placeholder="请选择更新年月" format="YYYY-MM" valueFormat="YYYY-MM" v-model="queryParam.ym" v-decorator="['ym', {}]" />-->
            <!--</a-form-item>-->
          <!--</a-col>-->
          <!--<a-col :xl="6" :lg="7" :md="8" :sm="24">-->
            <!--<a-form-item label="出库年月">-->
              <!--<a-range-picker style="width:100%"-->
                              <!--format="YYYY-MM"-->
                              <!--valueFormat="YYYY-MM"-->
                              <!--v-model="queryParam.ymS"-->
                              <!--:defaultPickerValue="moment">-->
              <!--</a-range-picker>-->
            <!--</a-form-item>-->
          <!--</a-col>-->
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item
              label="版本号">
              <a-month-picker style="width:100%" placeholder="请选择版本号" format="YYYY-MM" valueFormat="YYYY-MM" v-model="queryParam.ymStart" v-decorator="['ymStart', {}]" />
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="门店编码">
              <a-input placeholder="请输入门店编码模糊查询" v-model="queryParam.terminalCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="门店名称">
              <a-input placeholder="请输入门店名称模糊查询" v-model="queryParam.terminalName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="隶属经销商编码">
              <a-input placeholder="请输入经销商编码" v-model="queryParam.custCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="隶属经销商">
              <a-input placeholder="请输入经销商模糊查询" v-model="queryParam.custName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="品类">
              <a-input placeholder="请输入品类" v-model="queryParam.productType"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="产品编码">
              <a-input placeholder="请输入产品编码" v-model="queryParam.productCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="产品名称">
              <a-input placeholder="请输入产品名称模糊查询" v-model="queryParam.productName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="批次号">
              <a-input placeholder="请输入批次号" v-model="queryParam.flot"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="国内批次号">
              <a-input placeholder="请输入国内批次号" v-model="queryParam.auxPropId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="大区">
              <a-input placeholder="请输入大区" v-model="queryParam.region"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
<!--      <a-button type="primary" icon="update" @click="doSellOutData">数据更新</a-button>-->
      <a-button type="primary" icon="download" @click="downExportXls('sell_out_report')">导出</a-button>
    </div>
    <!-- 操作按钮区域 -->


    <!-- table区域-begin --> <!--<div class="table-operator">-->
    <!--<a-dropdown v-if="selectedRowKeys.length > 0">-->
    <!--<a-menu slot="overlay">-->
    <!--<a-menu-item key="1" @click="updateApprovalBatch">-->
    <!--<a-icon type="text"/>-->
    <!--审批-->
    <!--</a-menu-item>-->
    <!--</a-menu>-->
    <!--<a-button style="margin-left: 8px"> 批量操作-->
    <!--<a-icon type="down"/>-->
    <!--</a-button>-->
    <!--</a-dropdown>-->
    <!--</div>-->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">


      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <!--<sfaPicFactory-modal ref="modalForm" @ok="modalFormOk"></sfaPicFactory-modal>-->
  </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import {PageListMixin} from '@/mixins/PageListMixin'
  import {getAction, postAction} from '@/api/manage'
  import ARow from 'ant-design-vue/es/grid/Row'

  export default {
    name: 'SfaPicUploadList',
    mixins: [PageListMixin],
    components: {
      ARow
    },
    data() {
      return {
        description: 'sellOut页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: '版本号',
            align: "center",
            dataIndex: 'ym'
          },
          {
            title: '门店编码',
            align: "center",
            dataIndex: 'terminalCode'
          },
          {
            title: '门店名称',
            align: "center",
            dataIndex: 'terminalName'
          },
          {
            title: '渠道类型',
            align: "center",
            dataIndex: 'channel'
          },
          {
            title: '是否总仓',
            align: "center",
            dataIndex: 'storeName'
          },
          {
            title: '门店等级',
            align: "center",
            dataIndex: 'terminalLevel'
          },
          {
            title: '总仓门店编码',
            align: "center",
            dataIndex: 'paretTermCode'
          },
          {
            title: '总仓门店名称',
            align: "center",
            dataIndex: 'prentTermName'
          },
          {
            title: '分销门店数量',
            align: "center",
            dataIndex: 'num'
          },
          {
            title: '直供/间供',
            align: "center",
            dataIndex: 'supply'
          },
          {
            title: '隶属经销商编码',
            align: "center",
            dataIndex: 'custCode'
          },
          {
            title: '隶属经销商',
            align: "center",
            dataIndex: 'custName'
          },
          {
            title: '对接经销商业务员',
            align: "center",
            dataIndex: 'code'
          },
          {
            title: '销商业务员',
            align: "center",
            dataIndex: 'name'
          },
          {
            title: '门店联系人',
            align: "center",
            dataIndex: 'linkman'
          },
          {
            title: '门店联系人手机号',
            align: "center",
            dataIndex: 'telephone'
          },
          {
            title: '大区经理',
            align: "center",
            dataIndex: 'dqManger'
          },
          {
            title: '省经理',
            align: "center",
            dataIndex: 'provinceManager'
          },
          {
            title: '销售主管',
            align: "center",
            dataIndex: 'saleManager'
          },
          {
            title: '大区',
            align: "center",
            dataIndex: 'region'
          },
          {
            title: '省份',
            align: "center",
            dataIndex: 'province'
          },
          {
            title: '城市',
            align: "center",
            dataIndex: 'city'
          }, {
            title: '区县',
            align: "center",
            dataIndex: 'area'
          }, {
            title: '乡镇',
            align: "center",
            dataIndex: 'town'
          }, {
            title: '详细地址',
            align: "center",
            dataIndex: 'address'
          }, {
            title: '营业执照号',
            align: "center",
            dataIndex: 'businesslicense'
          }, {
            title: '门店申请注册日期',
            align: "center",
            dataIndex: 'terminalDate'
          }, {
            title: '品牌',
            align: "center",
            dataIndex: 'brandName'
          }, {
            title: '品类',
            align: "center",
            dataIndex: 'productType'
          },
          {
            title: '产品编码',
            align: "center",
            dataIndex: 'productCode'
          },
          {
            title: '产品名称',
            align: "center",
            dataIndex: 'productName'
          },
          {
            title: '箱规',
            align: "center",
            dataIndex: 'boxNum'
          },
          {
            title: '条码',
            align: "center",
            dataIndex: 'barCode'
          },
          {
            title: '批次号',
            align: "center",
            dataIndex: 'flot'
          },
          {
            title: '国内批次号',
            align: "center",
            dataIndex: 'auxPropId'
          },
          {
            title: '有机码',
            align: "center",
            dataIndex: 'syCode'
          },
          {
            title: '订单数量',
            align: "center",
            dataIndex: 'orderNum'
          },
          {
            title: '订单总金额',
            align: "center",
            dataIndex: 'amount'
          },
          {
            title: '回单日期',
            align: "center",
            dataIndex: 'raeceiptDate'
          }
        ],
        url: {
          list: window._CONFIG['domianSfaURL'] + "/sy/sellOutController/findPageList",
          doSellOutData: window._CONFIG['domianSfaURL'] + "/sy/sellOutController/doSellOutData",
        },
      }
    },
    methods: {
      doSellOutData(){
        var that = this
        if (!this.url || !this.url.doSellOutData) {
          // this.$message.error("请设置url.list属性!")
          return
        }
        // var params = this.getQueryParams();//查询条件
        this.loading = true;
        postAction(this.url.doSellOutData).then((res) => {
          if (res.success) {
            that.$message.success(res.message);
            that.loadData();
          }else {
            that.$message.warning(res.message);
          }
          that.loading = false;
        })
      }
    }
  }
</script>

<style scoped>
  @import '~@assets/less/common.less';

</style>